package com.hejielife.activeobject1;

/**
 * 2019年8月2日 下午5:14:58
 * 
 * @author hejielife
 * @despribe SchedulerThread
 */
class SchedulerThread extends Thread {
	private final ActivationQueue queue;

	public SchedulerThread(ActivationQueue queue) {
		this.queue = queue;
	}

	public void invoke(MethodRequest request) {
		queue.putRequest(request);
	}

	public void run() {
		while (true) {
			MethodRequest request = queue.takeRequest();
			request.execute();
		}
	}
}
